home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / prolog.arc / FAMILY.FIL < prev    next >
Text File  |  1985-07-11  |  870b  |  31 lines

  1. /*=============================================================================*/
  2. /* To analyze the family structure of the family of Queen Victoria.
  3. English friend of mine notes there wasn't a Harry. I put him in.
  4.  
  5. Answers the compelling question: Who is X the sister of?
  6.  
  7. Ask: ?-sisterof( alice, X ). or ?-sisterof( alice, harry ).
  8.  
  9.   or ?-sisterof( alice, X ), loves( X, wine ). as an example of a
  10.   complex question.
  11.  
  12. or even:
  13.  
  14. sisterof( alice, X ), loves( X, wine ), loves( alice, wine ).
  15.  
  16. */
  17.  
  18. sisterof( X, Y ) :- parents( X, M, F ),
  19.             female( X ),
  20.             parents( Y, M, F ).
  21.  
  22. parents( edward, victoria, albert ).
  23. parents( harry, victoria, albert ).
  24. parents( alice, victoria, albert ).
  25. female( alice ).
  26.  
  27. loves( harry, wine ).
  28. loves( alice, wine ).
  29.  
  30. /*=============================================================================*/
  31.